#!/bin/sh

start() {
	echo -n "Starting uptimed: "
	/usr/sbin/uptimed -b
	start-stop-daemon --quiet --start --pidfile /var/run/uptimed/pid --exec /usr/sbin/uptimed -- -p /var/run/uptimed/pid
	echo "OK"
}

stop() {
	echo -n "Stopping uptimed: "
	start-stop-daemon --quiet --stop --pidfile /var/run/uptimed/pid
	echo "OK"
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
restart)
        stop
        start
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac
